package com.clown.repositories;

import com.clown.pojo.Customer;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Description 规定方法名，作查询，不需要写sql
 * @Author ZL
 * @Date 2022-02-13 10:58
 * @Version 1.0
 */
public interface CustomerMethodRepository  extends PagingAndSortingRepository<Customer, Long> {
    List<Customer> findByCustName(String custName);

    boolean existsByCustName(String custName);

    @Transactional
    @Modifying
    int deleteByCustId(Long custName);

    List<Customer> findByCustNameLike(String custName);
}
